<template>
  <div>
    <Header :title='title' @navigate="toPath"></Header>
    <router-view v-if="routerAlive"/>
    <Bar :url="url"></Bar>
  </div>
</template>

<script>
  import Header from '@/components/main/Header'
  import Bar from '@/components/bar'
  export default {
    data() {
      return {
        title: 'Z MUSIC',
        url: '',
        routerAlive: true
      }
    },
    provide(){
      return {
        reloadRouter: this.reloadRouter
      }
    },
    methods: {
      toPath(path) {
        this.$router.push(path)
      },
      reloadRouter(){
        this.routerAlive = false
        this.$nextTick(()=>{
          this.routerAlive = true
        })
      }
      // async setUserCookie() {
      //   this.setCookie('asjdh_dafhia','1234567',30)
      //   const token = this.getCookie('asjdh_dafhia')
      //   console.log(token)
      //   const res = await this.$http.post('/user/setCookie', {
      //     data: "RK=WWqpnD1ncb; _qpsvr_localtk=0.1561531392451212; pgv_flv=27.0 r0; pgv_info=ssid=s6714203722; pgv_pvi=7028595712; pgv_pvid=7727281440; pgv_si=s6697114624; ptcz=d863681ae770b0b1e1487adfcb3bdcc3ce3b94e8940c95f7e777af413e9c873b; skey=@M2fr359qL; tvfe_boss_uuid=18f17c16d774c81d; uin=o01234567;"
      //   })
      // },
      // async getUserCookie() {
      //   const res = await this.$http.get('/user/cookie')
      //   console.log(res)
      // }
      // setUserCookie() {
      //   this.setCookie('userCookie','1234567',30)
      //   const token = this.getCookie('userCookie')
      //   console.log(typeof token)
      // }
    },
    components: {
      Header,
      Bar
    }
  }
</script>

<style>
</style>
